//
//  SetupViewController.m
//  Juejue
//  
//  Created by 吴军虎吴军虎 on 16/3/22.
//  Copyright © 2016年 lanjue. All rights reserved.
//

#import "SetupViewController.h"
#import "SevenSwitch.h"

@interface SetupViewController ()

@property (nonatomic,retain) UIView *myheaderView;
@property(nonatomic,retain)UITextField *suoLabel;
@property (nonatomic,retain) UIView *Wview;
@property(nonatomic,assign)BOOL isSelrct;
@property(nonatomic,retain)UIView * fenVIE;
@property(nonatomic,retain)UIView *backView;

@end

@implementation SetupViewController

-(void)viewWillAppear:(BOOL)animated{
    
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.hidden=YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden=NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor=LV;
    
    self.title=@"设置提醒";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(Back:)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
    
    //声音与振动
    [self createSheng];
    
    //通知提醒
    [self createTong];
    
    //分享
    [self createFen];
    
}

#pragma mark 声音与振动
-(void) createSheng
{
    //声音与振动
    UILabel *label=[[UILabel alloc]init];
    label.text=@"声音与振动";
    label.textColor=HS;
    label.font=[UIFont fontWithName:ZIXING size:13*AUTO_WIDTH];
    [self.view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(self.view).offset(14/2 *AUTO_HEIGHT);
        make.left.mas_equalTo(15.00 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(6*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));
    }];
    
    
    //白色底框
    _Wview=[[UIView alloc]init];
    _Wview.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_Wview];
    [_Wview mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(label.mas_bottom).offset(14/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width , 50 *AUTO_WIDTH));
    }];
    
    
    //画线
    UIView *Xan3=[[UIView alloc]init];
    Xan3.backgroundColor=KH;
    Xan3.alpha=0.5;
    [self.view addSubview:Xan3];
    [Xan3 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_Wview.mas_top).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];
    
    
    //画线
    UIView *Xan4=[[UIView alloc]init];
    Xan4.backgroundColor=KH;
    Xan4.alpha=0.5;
    [self.view addSubview:Xan4];
    [Xan4 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_Wview.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];
    
    //声音与振动
    UILabel *label1=[[UILabel alloc]init];
    label1.text=@"声音与振动";
    label1.textColor=HS;
    label1.font=[UIFont fontWithName:ZIXING size:15*AUTO_WIDTH];
    [_Wview addSubview:label1];
    [label1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_Wview.mas_top).offset(28/2 *AUTO_WIDTH);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(6*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));
    }];
    
    
    SevenSwitch *mySwitch = [[SevenSwitch alloc] init];
    [mySwitch addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:mySwitch];
    mySwitch.on = YES;
    [mySwitch mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_Wview.mas_top).offset(20/2 *AUTO_WIDTH);
        make.left.equalTo(_Wview.mas_right).offset(-130/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(50.00 *AUTO_WIDTH, 30.00 *AUTO_WIDTH));
        
    }];

}

#pragma mark 通知提醒
-(void) createTong
{
    //通知提醒
    UILabel *label3=[[UILabel alloc]init];
    label3.text=@"通知提醒";
    label3.textColor=HS;
    label3.font=[UIFont fontWithName:ZIXING size:13*AUTO_WIDTH];
    [self.view addSubview:label3];
    [label3 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_Wview.mas_bottom).offset(14/2 *AUTO_HEIGHT);
        make.left.mas_equalTo(15.00 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(6*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));
        
    }];
    
    //第二个白色底框
    UIView *Hview=[[UIView alloc]init];
    Hview.backgroundColor=[UIColor whiteColor];
    Hview.userInteractionEnabled=YES;
    UITapGestureRecognizer *htap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(vtap:)];
    [Hview addGestureRecognizer:htap];
    [self.view addSubview:Hview];
    [Hview mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(label3.mas_bottom).offset(14/2 *AUTO_HEIGHT);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width , 50 *AUTO_WIDTH));
    }];
    
    
    //画线
    UIView *Xan5=[[UIView alloc]init];
    Xan5.backgroundColor=KH;
    Xan5.alpha=0.5;
    [self.view addSubview:Xan5];
    [Xan5 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview.mas_top).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];
    
    
    
    //有人对我的任务感兴趣
    UILabel *label4=[[UILabel alloc]init];
    label4.text=@"有人对我的任务感兴趣";
    label4.textColor=HS;
    label4.font=[UIFont fontWithName:ZIXING size:15*AUTO_WIDTH];
    [Hview addSubview:label4];
    [label4 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview.mas_top).offset(28/2 *AUTO_WIDTH);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(40*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));
    }];
    
    
    //箭头
    UIImageView *image4=[[UIImageView alloc]init];
    image4.image=[UIImage imageNamed:@"arrow"];
    [Hview addSubview:image4];
    [image4 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview.mas_top).offset(35/2 *AUTO_WIDTH);
        make.right.mas_equalTo(-21.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(9.00*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //每日提醒
    UILabel *lab=[[UILabel alloc]init];
    lab.text=@"每日提醒";
    lab.textColor=GH;
    lab.font=[UIFont fontWithName:ZIXING size:14*AUTO_WIDTH];
    [self.view addSubview:lab];
    [lab mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview.mas_top).offset(38/2 *AUTO_WIDTH);
        make.right.equalTo(image4.mas_right).offset(-45/2 *AUTO_WIDTH);
    }];
    
    //画线
    UIView *Xan=[[UIView alloc]init];
    Xan.backgroundColor=KH;
    Xan.alpha=0.5;
    [self.view addSubview:Xan];
    [Xan mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview.mas_bottom).offset(0);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];
    
    
    //第三个白色底框
    UIView *Hview1=[[UIView alloc]init];
    Hview1.backgroundColor=[UIColor whiteColor];
    Hview1.userInteractionEnabled=YES;
    UITapGestureRecognizer *httap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(vtap:)];
    [Hview1 addGestureRecognizer:httap];
    [self.view addSubview:Hview1];
    [Hview1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Xan.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width ,50 *AUTO_WIDTH));
    }];
    
    
    //箭头
    UIImageView *image5=[[UIImageView alloc]init];
    image5.image=[UIImage imageNamed:@"arrow"];
    [Hview1 addSubview:image5];
    [image5 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview1.mas_top).offset(35/2 *AUTO_WIDTH);
        make.right.mas_equalTo(-21.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(9.00*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //每日提醒
    UILabel *lab1=[[UILabel alloc]init];
    lab1.text=@"每日提醒";
    lab1.textColor=GH;
    lab1.font=[UIFont fontWithName:ZIXING size:14*AUTO_WIDTH];
    [Hview1 addSubview:lab1];
    [lab1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview1.mas_top).offset(38/2 *AUTO_WIDTH);
        make.right.equalTo(image5.mas_right).offset(-45/2 *AUTO_WIDTH);
    }];
    
    
    //有人查看我的任务
    UILabel *label5=[[UILabel alloc]init];
    label5.text=@"有人查看我的任务";
    label5.textColor=HS;
    label5.font=[UIFont fontWithName:ZIXING size:15*AUTO_WIDTH];
    [self.view addSubview:label5];
    [label5 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview1.mas_top).offset(28/2 *AUTO_WIDTH);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(40*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));    }];
    
    //画线
    UIView *Xan1=[[UIView alloc]init];
    Xan1.backgroundColor=KH;
    [self.view addSubview:Xan1];
    [Xan1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview1.mas_bottom).offset(0);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];
    
    //第三个白色底框
    UIView *Hview2=[[UIView alloc]init];
    Hview2.backgroundColor=[UIColor whiteColor];
    Hview2.userInteractionEnabled=YES;
    UITapGestureRecognizer *hhtap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(vtap:)];
    [Hview2 addGestureRecognizer:hhtap];
    
    [self.view addSubview:Hview2];
    [Hview2 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Xan1.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width , 50 *AUTO_WIDTH));
    }];
    
    
    //我发布的任务类别有新人注册
    UILabel *label6=[[UILabel alloc]init];
    label6.text=@"我发布的任务类别有新人注册";
    label6.textColor=HS;
    label6.font=[UIFont fontWithName:ZIXING size:15*AUTO_WIDTH];
    [self.view addSubview:label6];
    [label6 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview2.mas_top).offset(28/2 *AUTO_WIDTH);
        make.left.mas_equalTo(15.00 * AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(40*18.00*AUTO_WIDTH, 25.00*AUTO_WIDTH));
    }];
    
    
    //箭头
    UIImageView *image6=[[UIImageView alloc]init];
    image6.image=[UIImage imageNamed:@"arrow"];
    [Hview2 addSubview:image6];
    [image6 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview2.mas_top).offset(35/2 *AUTO_WIDTH);
        make.right.mas_equalTo(-21.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(9.00*AUTO_WIDTH, 15.00*AUTO_WIDTH));
    }];
    
    //每日提醒
    UILabel *lab2=[[UILabel alloc]init];
    lab2.text=@"每日提醒";
    lab2.textColor=GH;
    lab2.font=[UIFont fontWithName:ZIXING size:14*AUTO_WIDTH];
    [Hview2 addSubview:lab2];
    [lab2 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview2.mas_top).offset(38/2 *AUTO_WIDTH);
        make.right.equalTo(image6.mas_right).offset(-45/2 *AUTO_WIDTH);
    }];
    
    //画线
    UIView *Xan6=[[UIView alloc]init];
    Xan6.backgroundColor=KH;
    Xan6.alpha=0.5;
    [self.view addSubview:Xan6];
    [Xan6 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Hview2.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1*AUTO_WIDTH));
    }];

}

#pragma mark 分享
-(void) createFen
{
    //    分享
    self.fenVIE = [[UIView alloc]init];
    self.fenVIE.alpha = 0;
    self.fenVIE.backgroundColor =[UIColor whiteColor];
    [self.view addSubview:_fenVIE];
    [_fenVIE mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.view.mas_bottom).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 163.00*AUTO_WIDTH));
        
    }];
    
    
    //即时提醒
    UILabel *labe=[[UILabel alloc]init];
    labe.text=@"即时提醒";
    labe.textColor=GH;
    labe.font=[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH];
    labe.userInteractionEnabled=YES;
    UITapGestureRecognizer *labetap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labAction:)];
    [labe addGestureRecognizer:labetap];
    [_fenVIE addSubview:labe];
    [labe mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(_fenVIE.mas_top).offset(50/2 *AUTO_WIDTH);
        make.left.equalTo(_fenVIE.mas_left).offset(309/2 *AUTO_WIDTH);
    }];
    
    //划线
    UIView *Vie=[[UIView alloc]init];
    Vie.backgroundColor=[UIColor grayColor];
    Vie.alpha=0.5;
    [_fenVIE addSubview:Vie];
    [Vie mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(labe.mas_bottom).offset(30/2 *AUTO_WIDTH);
        make.left.equalTo(_fenVIE.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1 *AUTO_WIDTH));
        
    }];
    
    
    //每日提醒
    UILabel *labe1=[[UILabel alloc]init];
    labe1.text=@"每日提醒";
    labe1.textColor=GH;
    labe1.font=[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH];
    labe1.userInteractionEnabled=YES;
    UITapGestureRecognizer *labtap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labAction:)];
    [labe1 addGestureRecognizer:labtap];
    [_fenVIE addSubview:labe1];
    [labe1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Vie.mas_top).offset(30/2 *AUTO_WIDTH);
        make.left.equalTo(_fenVIE.mas_left).offset(309/2 *AUTO_WIDTH);
    }];
    
    //划线
    UIView *Vie1=[[UIView alloc]init];
    Vie1.backgroundColor=[UIColor grayColor];
    Vie1.alpha=0.5;
    [_fenVIE addSubview:Vie1];
    [Vie1 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(labe1.mas_bottom).offset(30/2 *AUTO_WIDTH);
        make.left.equalTo(_fenVIE.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, 1 *AUTO_WIDTH));
        
    }];
    
    //每周提醒
    UILabel *labe2=[[UILabel alloc]init];
    labe2.text=@"每周提醒";
    labe2.textColor=GH;
    labe2.font=[UIFont fontWithName:ZIXING size:15.00 *AUTO_WIDTH];
    labe2.userInteractionEnabled=YES;
    UITapGestureRecognizer *latap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labAction:)];
    [labe2 addGestureRecognizer:latap];
    [_fenVIE addSubview:labe2];
    [labe2 mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(Vie1.mas_top).offset(30/2 *AUTO_WIDTH);
        make.left.equalTo(_fenVIE.mas_left).offset(309/2 *AUTO_WIDTH);
    }];
    
    
    self.backView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-228.00 *AUTO_WIDTH)];
    self.backView.alpha=0.0;
    self.backView.backgroundColor=[UIColor grayColor];
    self.backView.userInteractionEnabled=YES;
    UITapGestureRecognizer *backtap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(backAction:)];
    [self.backView addGestureRecognizer:backtap];
    [self.view addSubview:self.backView];
    
    

}

-(void) vtap:(UITapGestureRecognizer *) tap
{
    self.isSelrct =! self.isSelrct;

    if (self.isSelrct) {
        self.fenVIE.alpha = 0.8;
        self.fenVIE.backgroundColor = [UIColor whiteColor];
        self.backView.alpha=0.3;
    }
    
    self.isSelrct =! self.isSelrct;

}

-(void) switchChanged:(UIButton *) btn
{
    NSLog(@"滑动滑动滑动");
}

-(void) labAction:(UITapGestureRecognizer *) tap
{
    
    self.fenVIE.alpha = 0;
    self.backView.alpha=0;
    
}

-(void) backAction:(UITapGestureRecognizer *) tap
{
    
    self.fenVIE.alpha = 0;
    self.backView.alpha=0;
    
}

//返回上一页
-(void)Back:(UIButton *)goback{
    
    [self.navigationController popViewControllerAnimated:YES];
}

@end
